package com.guohui.boot1.service.impl;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.guohui.boot1.dao.DemoUserMapper;
import com.guohui.boot1.entity.DemoUser;
import com.guohui.boot1.service.DemoUserService;


@Service("demoUserService")
public class DemoUserServiceImpl implements DemoUserService{

  @Autowired
  private DemoUserMapper demoUserMapper;
  
  @Override
  @Transactional(isolation=Isolation.READ_COMMITTED,propagation=Propagation.REQUIRED)
  public int save(DemoUser entity) {
    return this.demoUserMapper.insert(entity);
  }

  @Override
  public int removeById(Long id) {
    return this.demoUserMapper.deleteById(id);
  }

  @Override
  public int updateById(DemoUser entity) {
    return this.demoUserMapper.updateById(entity);
  }

  @Override
  //@Cacheable(key="#id",value="user")
  public DemoUser getById(Long id) {
    return this.demoUserMapper.getById(id);
  }

  @Override
  public List<DemoUser> findList() {
    return this.demoUserMapper.findList();
  }
	

}
